package com.servlet.hello;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

/**
 * @author wzm
 * @create 2023-11-04 11:35
 * project_name:web2310
 * @Description
 */
//实现Servlet入门程序 当客户端访问/hello时，就会调用service方法
//斜杆意思等同于当前项目  http://localhost:8080/项目/
//@WebServlet(value ="/hello")
//@WebServlet(urlPatterns ="/hello")
@WebServlet("/hello")
public class HelloServlet1 implements Servlet {
    //重写抽象方法
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }
    @Override
    public ServletConfig getServletConfig() {
        return null;
    }
   //路径匹配会自动执行的方法
    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("HelloWorld,Servlet程序执行了");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
